-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HHH-19498 - improve upserts on MySQL and Maria #10275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
918613e
to
4a39789
Compare
...re/src/main/java/org/hibernate/dialect/sql/ast/SqlAstTranslatorWithOnDuplicateKeyUpdate.java
Fixed
Show fixed
Hide fixed
517ce5f
to
8c07fc9
Compare
private void renderVersionRestriction(String tableName, List<ColumnValueBinding> optimisticLockBindings, int index) { | ||
final String operator = index == 0 ? ":=" : ""; | ||
final String versionVariable = "@oldversion" + operator; | ||
for (int i = 0; i < optimisticLockBindings.size(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this written now you must assert optimisticLockBindings.size() == 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know, I left that pending.
There is however a bigger problem with this issue, in that we don't seem to have a way to distinguish a new insert (returned rowcount == 1), from a potential stale upsert (rowcount is 1 as well), which is why I invalidated that test.
Said test shouldn't have been invalidated however, as Gavin pointed out, since knowing that a stale upsert was attempted is important.
I think what we need to do here is fall back to the "dumb" approach (with an We can still use this new strategy when there is no version to check. |
Signed-off-by: Jan Schatteman <[email protected]>
8c07fc9
to
9ad84bd
Compare
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19498